<script setup>
import { reactive } from 'vue'

//定义时间传递对象
const $emits = defineEmits(['searchParamsBtnEmits', 'resetParamsBtnEmits'])

const searchForm = reactive({
  deptName: '',
  status: ''
})

//搜索用户信息参数传递
const searchBtn = () => {
  $emits('searchParamsBtnEmits', searchForm)
}

const resetBtn = () => {
  Object.assign(searchForm, {
    deptName: '',
    status: ''
  })
  $emits('resetParamsBtnEmits')
}
</script>

<template>
  <div class="search">
    <el-form :model="searchForm">
      <el-row>
        <el-col :span="8">
          <el-form-item label="部门名称" label-width="100px">
            <el-input v-model="searchForm.deptName" placeholder="请输入部门名称" />
          </el-form-item>
        </el-col>
        <el-col :span="8" class="status-col">
          <el-form-item label="状态" label-width="50px">
            <el-select v-model="searchForm.status" placeholder="请选择状态" size="default">
              <el-option label="启用" :value="0" />
              <el-option label="禁用" :value="1" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-button type="primary" @click="searchBtn">
          <el-icon>
            <Search />
          </el-icon>
          <span>搜索</span>
        </el-button>
        <el-button @click="resetBtn">
          <el-icon>
            <RefreshRight />
          </el-icon>
          <span>重置</span>
        </el-button>
      </el-row>
    </el-form>
  </div>
</template>

<style scoped lang="less">
.search {
  .el-form-item {
    font-weight: 700;
    padding: 0 30px 0 30px;
  }

  margin-top: 20px;

  .el-col {
    margin-bottom: 20px;
  }

  .el-button {
    width: 80px;
  }
}
</style>
